<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<title>选择橱窗模块</title>
<link type="text/css" href="../css/reset.css" rel="stylesheet" />
<link type="text/css" href="../css/public.css" rel="stylesheet" />
<link type="text/css" href="../css/style.css" rel="stylesheet" />
<link type="text/css" href="../css/wode.css" rel="stylesheet" />
<script>
    var deviceWidth = Math.min(640, window.innerWidth)
    document.documentElement.style.fontSize = deviceWidth / 7.5 + "px"
</script>
  <script src="../js/jquery.min.js?v=2.1.4"></script>
<script src="../js/core.js"></script>
<script src="../js/31.1.0zhuangxiudianpumokuai.js"></script>

</head>

<body>
<!-- top -->
<div class="header">
    <header class="p_header public-red">
        <a href="javascript:history.go(-1);" class="p_header_left">
            <i class="p_left" title="返回"></i>
        </a>
        <h1 class="p_dizhi">选择橱窗模块</h1>
    </header>
</div>
<!--选择橱窗模块-->

<div class="clearfix">
	<dl class="zhuangxiu_mokuai"  onclick="dianji(this)" id="1">
		<!--31.1.1zhuangxiudianpu_goods.html-->
	<dl><input type="checkbox" id="duoxuan" value="1" checked/></dl>	
			<dt>
				<img src="../images/mokuai01.jpg" />
			</dt>
			<dd>一行两列</dd>
		
	</dl>
	
	<dl class="zhuangxiu_mokuai" onclick="dianji(this)" id="2">
		<dl><input type="checkbox" id="duoxuan" value="2" checked/></dl>	
			<dt>
				<img src="../images/mokuai02.jpg" />
			</dt>
			<dd>一行三列</dd>
		
	</dl>
</div>
<div class="mid-width">
	<div class="zhuangxiu_title">
		<span>高级模块样式</span>
	</div>
</div>
<div class="clearfix">
	<dl class="zhuangxiu_mokuai" onclick="dianji(this)" id="3">
		<dl><input type="checkbox" id="duoxuan" value="3" checked/></dl>	
			<dt>
				<img src="../images/mokuai03.jpg" />
			</dt>
			<dd>大图</dd>
		
	</dl>
	<dl class="zhuangxiu_mokuai" onclick="dianji(this)" id="4">
	<dl><input type="checkbox" id="duoxuan" value="4" checked/></dl>		
			<dt>
				<img src="../images/mokuai04.jpg" />
			</dt>
			<dd>封面+细节图</dd>
		
	</dl>
</div>
    <div class="mid-width" id="buttenanniu">
	    <input type="button" onclick="tijiao()" class="p_button" value="下一步">
	</div>
	
	<div class="show2 sell-xiugai1">
	<h5>够买橱窗</h5>
	<div class="show2_anniu clearfix">
		<span>取消够买</span>
		<span onclick="zhuangxiudianpu2()">确认够买</span>
	</div>
</div>
</body>

<script>
	
	
	
	function dianji(te){
		
		$(".zhuangxiu_mokuai").each(function(){
				$(this).css("background","");
				$(this).children("dl").find("#duoxuan").prop("checked", false);
		});
		
		$(te).css("background","#ff0000");
		$(te).children("dl").find("#duoxuan").prop("checked",true);
	}
	
var id = getvl("id");
	 $(function(){
	    if(id!=''){
	    	  zhanghuxinxiss(id);
	    }else{
	    	alert("异常！！！");
	    }
});

	var distype="";
 function  zhanghuxinxiss(id){
   	$.ajax({
		url: urlcore + "/api/shopInfo/selectagno1?shopId="+id,
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
				alert(JSON.stringify(data.data));
				distype=data.data.displayType;
				  if(data.data.displayType==1){
				  	$(".zhuangxiu_mokuai").each(function(){
				  		  if($(this).attr("id")==1){
				  		     $(this).css("background","#ff0000");
				  		     $(this).children("dl").find("#duoxuan").prop("checked",true);
				  		  }else{
				  		  	$(this).children("dl").find("#duoxuan").prop("checked", false);
				  		  $(this).css("background","");
				  		  }
		        });
		                
				  }else if(data.data.displayType==2){
				  		$(".zhuangxiu_mokuai").each(function(){
				  		  if($(this).attr("id")==2){
				  		     $(this).css("background","#ff0000");
				  		     $(this).children("dl").find("#duoxuan").prop("checked",true);
				  		  }else{
				  		  $(this).css("background","");
				  		  $(this).children("dl").find("#duoxuan").prop("checked", false);
				  		  }
		        });
				  }else if(data.data.displayType==3){
				  	
				  		$(".zhuangxiu_mokuai").each(function(){
				  		  if($(this).attr("id")==3){
				  		     $(this).css("background","#ff0000");
				  		        $(this).children("dl").find("#duoxuan").prop("checked",true);
				  		  }else{
				  		  $(this).css("background","");
				  		  $(this).children("dl").find("#duoxuan").prop("checked", false);
				  		  }
		        });
				  }else if(data.data.displayType==4){
				  		$(".zhuangxiu_mokuai").each(function(){
				  		  if($(this).attr("id")==4){
				  		$(this).css("background","#ff0000");
				  		$(this).children("dl").find("#duoxuan").prop("checked", true);

				  		  }else{
				  		  $(this).css("background","");
				  		   $(this).children("dl").find("#duoxuan").prop("checked", false);
				  		  }
		        });
				  }
			}
		},
		error:function() {
			/* Act on the event */
			alert("error");
		}
	});	
}



var types="";
function tijiao(){
	
	  $("#duoxuan").each(function(){
	  	   if($(this).prop('checked')==true){
	  	   	  types=$(this).val();
	  	   	  alert(".."+types);
	  	   }
	  });
	    if(types==1){
	    	zhuangxiudianpu();
	    }else if(types==2){
	    	zhuangxiudianpu();
	    }else if(types==3){
	    	if(types==distype){
	    		alert("已购买过");
	    	}else{
	    $("body").append("<div id='mask'></div>");
        $(".sell-xiugai1").show();
	    	}
	    	
	    }else if(types==4){
	    	if(types==distype){
	    		alert("已购买过");
	    	}else{
	    $("body").append("<div id='mask'></div>");
        $(".sell-xiugai1").show();
	    	}
	    	//zhuangxiudianpu();
	    }
}

function zhuangxiudianpu(){
	    $.ajax({  
        url : urlcore + "/api/shopInfo/Gomodify",
        type : "post",  
        contentType: "application/json;charset=utf-8",
        data :  JSON.stringify({  //所在省市
        	  "id":id,
              "displayType":types
        	}),
        	dataType: "json",
        success: function(data) {//data是返回的hash,key之类的值，key是定义的文件名 
        	alert("修改成功!");
        	window.location.href = document.referrer
        },
        error:function(){  
            alert("修改失败");  
        }  
    });     
}


function zhuangxiudianpu2(){
	alert("跳转 付款界面")
	
}

</script>
<script type="text/javascript">

    //点击关闭
    $(".show2_anniu span").on('click',function(){
        $(".sell-xiugai1").hide();
        $("#mask").remove();
    }) 
</script>
</html>